package activity.com.myappdata;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

import activity.com.myappdata.widgets.FloatingView;

public class MyService extends Service {
    public static final String ACTION="action";
    public static final String SHOW="show";
    public static final String HIDE="hide";
    private FloatingView mFloatingView;

    @Override
    public void onCreate(){
        super.onCreate();
        mFloatingView=new FloatingView(this);
    }

    @Override
    public IBinder onBind(Intent intent){
        return null;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        if (intent != null) {
            String action=intent.getStringExtra(ACTION);
            if(SHOW.equals(action)){
                mFloatingView.show();
            }else if(HIDE.equals(action)){
                mFloatingView.hide();
            }
        }
        return super.onStartCommand(intent, flags, startId);
    }
        }
